/**
 * Copyright (C) 2016 Juno Inc., All Rights Reserved.
 */
package com.jyl.designPattern.structure.flyWeight;

import java.util.HashMap;

/**
 *
 * @author Long, E-mail:jyl0401@163.com
 * @date 2019年4月20日 下午5:58:34
 */
public class FlyWeightFactory {
	
	private HashMap<String,FlyWeight> map = new HashMap<String,FlyWeight>();

	public FlyWeight getFlyWeight(String intrinsicState){
		
		FlyWeight flyWeight = new ConcreateFlyWeight(intrinsicState);
		if(!map.containsKey(intrinsicState)){
			map.put(intrinsicState, flyWeight);
		}
		return map.get(intrinsicState);
	}
}
